<template>
  <el-row class="list-container" :gutter="30">
    <el-col :span="8" :offset="4">
      <div class="image-wrapper">
        <img :src="data.propsData.city_img" :alt="data.propsData.title" class="cover-image" />
      </div>
    </el-col>
    <el-col :span="10" :offset="1">
      <div class="content-wrapper">
        <h1 class="title">{{ data.propsData.title }}</h1>
        <div class="location">
          <el-icon name="location" color="#00b2ff" size="20px" />
          <span>{{ data.propsData.city_name }}</span>
        </div>
        <div class="rating">
          <el-rate 
            v-model="icons" 
            :show-text="true" 
            :texts="['差', '一般', '好', '很好', '非常好']" 
            disabled 
            :icon-classes="['el-icon-star-on', 'el-icon-star-off']"
          />
          <span class="rating-text">已有 {{ data.propsData.hot }} 人点评</span>
        </div>
        <div class="description">{{ data.propsData.city_detail }}</div>
          <router-link :to="`/detail?id=${data.propsData.id}`"  class="view-more">查看更多</router-link>
          <slot name="footer">
        </slot>
      </div>
    </el-col>
  </el-row>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import { defineEmits } from 'vue';

// 这里后面添加一个评价的表以及信息
const icons = ref(5);


const data = defineProps<{
  propsData: {
    id : number,
    title:string,
    city_id:number,
    city_img:string,
    city_detail:string,
    hot:number,
    city_name:string
}
}>();

</script>

<style scoped>
.list-container {
  background: #ffffff;
  border-radius: 12px;
  padding: 24px;
  margin: 16px 0;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
}

.list-container:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.image-wrapper {
  overflow: hidden;
  border-radius: 8px;
}

.cover-image {
  width: 100%;
  height: 300px;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.cover-image:hover {
  transform: scale(1.05);
}

.content-wrapper {
  padding: 16px 0;
}

.title {
  font-size: 28px;
  font-weight: 600;
  color: #333;
  margin-bottom: 16px;
  line-height: 1.4;
}

.location {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  color: #666;
  font-size: 16px;
}

.rating {
  margin-bottom: 20px;
}

.rating-text {
  margin-left: 8px;
  color: #666;
  font-size: 14px;
}

.description {
  font-size: 16px;
  line-height: 1.6;
  color: #666;
  margin-bottom: 24px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  text-overflow: ellipsis;
}

.view-more {
  padding: 8px 24px;
  border-radius: 4px;
  font-size: 16px;
  background-color: aqua;
}
</style>